/**
 *
 */
package model;

import java.io.File;

/**
 * Represents a series episode.
 * 
 * @author Marco
 */
public class Episode implements IFile {
    private File   episodeFile;
    private int    episodeNumber;
    private String originalTitle;
    /**
     * Already has a points as prefix.
     */
    private String fileExtension;
    private String newFormattedTitle;

    public Episode(File aSeason, String anOriginalTitle) {
        episodeFile = new File(aSeason, anOriginalTitle);
        splitTitle(anOriginalTitle);
    }

    /**
     * Splits the full filename to episodetitle and filename extension;
     * 
     * @param aFullFilename
     */
    private void splitTitle(String aFullFilename) {
        int tempFilenameDelimiterpointPosition = aFullFilename.lastIndexOf(".");
        originalTitle = aFullFilename.substring(0,
                tempFilenameDelimiterpointPosition);
        fileExtension = aFullFilename
                .substring(tempFilenameDelimiterpointPosition);
    }

    /**
     * @return the episodeNumber
     */
    public int getEpisodeNumber() {
        return episodeNumber;
    }

    /**
     * @return the originalTitle
     */
    public String getOriginalTitle() {
        return originalTitle;
    }

    /**
     * @return the newFormattedTitle
     */
    public String getNewFormattedTitle() {
        return newFormattedTitle;
    }

    /**
     * @return the fileExtension
     */
    public String getFileExtension() {
        return fileExtension;
    }

    /*
     * (non-Javadoc)
     * 
     * @see IFile#getFile()
     */
    @Override
    public File getFile() {
        return episodeFile;
    }

}
